{extend name="template/base" /}
{block name="style"}
<!--select2样式 start -->
<link href="__LIB__/select2-4.0.3/dist/css/select2.min.css" rel="stylesheet" />
<!--select2样式 end -->
{/block}
{block name="content"}
<div class="page-container">
    <form class="form form-horizontal" id="form" method="post" action="{:\\think\\Request::instance()->baseUrl()}">
        <input type="hidden" name="id" value="{$vo.id ?? ''}">
        <!--用户选择 start -->
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">用户：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <select name="user_id" class="select2"  id="user_id">
                    {empty name = "vo['user_id']"}
                    <option value=""   >选择用户</option>
                    {/empty}
                    {volist name="users" id="user"}
                    <option value="{$user['id']}"  >{$user['id']}:{$user['realname']}：{$user['mobile']}</option>
                    {/volist}
                </select>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <!--用户选择 end -->
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">起始时间：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" autocomplete="off" class="input-text Wdate  " style="width:250px" placeholder="起始时间" name="start_time" value="{$vo.start_time ?? ''}" {literal} onfocus="WdatePicker({dateFmt: 'yyyy-MM-dd'})" {/literal} >

            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">结束时间：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" autocomplete="off" class="input-text Wdate  " style="width:250px" placeholder="结束时间" name="end_time" value="{$vo.end_time ?? ''}" {literal} onfocus="WdatePicker({dateFmt: 'yyyy-MM-dd'})" {/literal} >
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">请假原因：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <textarea class="textarea" placeholder="请假原因" name="reason">{$vo.reason ?? ''}</textarea>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">备注：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <script id="remark" name="remark" type="text/plain" style="height:100px;width: 100%;">{:htmlspecialchars_decode($vo.remark)}</script>

            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>


        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">状态：</label>
            <div class="formControls col-xs-6 col-sm-6 skin-minimal">
                <div class="radio-box">
                    <input type="radio" name="leave_status" id="leave_status-apply" value="apply" datatype="*" nullmsg="请选择状态">
                    <label for="leave_status-1">申请中</label>
                </div>
                <div class="radio-box">
                    <input type="radio" name="leave_status" id="leave_status-agree" value="agree">
                    <label for="leave_status-agree">已同意</label>
                </div>
                <div class="radio-box">
                <input type="radio" name="leave_status" id="leave_status-refuse" value="refuse">
                <label for="leave_status-refuse">拒绝</label>
                </div>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">是否同意：</label>
            <div class="formControls col-xs-6 col-sm-6 skin-minimal">
                <div class="radio-box">
                    <input type="radio" name="isagreee" id="isagreee-1" value="1" datatype="*" nullmsg="请选择状态">
                    <label for="isagreee-1">同意</label>
                </div>
                <div class="radio-box">
                    <input type="radio" name="isagreee" id="isagreee-0" value="0">
                    <label for="isagreee-0">不同意</label>
                </div>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>


        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <button type="submit" class="btn btn-primary radius">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>
                <button type="button" class="btn btn-default radius ml-20" onClick="layer_close();">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__LIB__/Validform/5.3.2/Validform.min.js"></script>

<!--select2 js 插件-->
<script type="text/javascript" src="__LIB__/select2-4.0.3/dist/js/select2.min.js"></script>

<!--时间插件-->
<script type="text/javascript" src="__LIB__/My97DatePicker/WdatePicker.js"></script>

<!--百度编辑器-->
<script>window.UEDITOR_HOME_URL = '__LIB__/ueditor/1.4.3/'</script>
<script type="text/javascript" charset="utf-8" src="__LIB__/ueditor/1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__LIB__/ueditor/1.4.3/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="__LIB__/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>

<script>
    $(function () {
        //用户select2 js部分 start
        var user_id = $("#user_id").select2({
            language: "zh-CN", //设置 提示语言
            width: "100%", //设置下拉框的宽度
            theme: "classic"
        });
        {notempty name = "vo['user_id']"}
        user_id.val("{$vo['user_id']}").trigger("change");
        {/notempty}
        //用户select2 js部分 end

            $("[name='leave_status'][value='{$vo.leave_status ?? '1'}']").attr("checked", true);
            $("[name='isagreee'][value='{$vo.isagreee ?? '1'}']").attr("checked", true);


            var remark = UE.getEditor('remark', {
                serverUrl: '{:\\think\\Url::build("Ueditor/index")}'
            });
            //remark.setContent("{$vo['remark']}");


        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });


        $("#form").Validform({
            tiptype: 2,
            ajaxPost: true,
            showAllError: true,
            callback: function (ret){
                remark.sync();

                ajax_progress(ret);
            }
        });
    })
</script>
{/block}
